package com.atguigu.flink.charkoer03;

import com.atguigu.flink.been.WaterSensor;
import org.apache.flink.api.common.serialization.SimpleStringSchema;
import org.apache.flink.client.program.StreamContextEnvironment;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer;

import javax.script.SimpleScriptContext;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;

public class FlinkWordCountTestGo2 {
    public static void main(String[] args) throws Exception {

//从java集合当中读取数据
        StreamExecutionEnvironment env = StreamContextEnvironment.getExecutionEnvironment();
        env.setParallelism(1);

        Properties prop = new Properties();
        prop.setProperty("bootstrap.servers", "hadoop162:9092");
        prop.setProperty("group.id", "gaowudi");
        DataStreamSource<String> source = env.addSource(new FlinkKafkaConsumer<>("topicA", new SimpleStringSchema(), prop));

        source.print();
        env.execute();
    }
}
